package com.hand.service;

import com.hand.dao.UserMapper;
import com.hand.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by 86136 on 2019/7/15.
 */

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

    @Transactional
    public String deleteUser(long userId){
        int key = userMapper.deleteUser(userId);
        String result = "删除成功"+key;
        return result;
    }

    @Transactional
    public String insertUser(User user) {
        int key = userMapper.insertUser(user);
        String result = "添加成功，用户id为："+user.getUserId();
        return result;
    }

    @Transactional
    public String updateUser(User user){
        int key = userMapper.updateUser(user);
        String result = "更新成功,用户id为："+user.getUserId();
        return result;
    }
}